﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

    <ControlTemplate x:Key="TextBoxErrorTemplate">
            <Border BorderThickness="1" BorderBrush="Red">
                <AdornedElementPlaceholder />
            </Border>
    </ControlTemplate>
    <Style TargetType="TextBox">
        <Setter Property="Margin" Value="4,4,10,4" />
        <Setter 
    Property="Validation.ErrorTemplate" 
    Value="{StaticResource TextBoxErrorTemplate}" 
    />
        <Style.Triggers>
            <Trigger Property="Validation.HasError" Value="True">
                <Setter Property="ToolTip">
                    <Setter.Value>
                        <Binding 
            Path="(Validation.Errors)[0].ErrorContent"
            RelativeSource="{x:Static RelativeSource.Self}"
            />
                    </Setter.Value>
                </Setter>
            </Trigger>
        </Style.Triggers>
    </Style>

</ResourceDictionary>